import { createApp } from 'vue'
import { createPinia } from 'pinia'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import App from './App.vue'
import router from './router'
import { useUserStore } from './store/user.js'

// 创建Vue应用实例
const app = createApp(App)

// 使用Pinia状态管理
const pinia = createPinia()
app.use(pinia)

// 使用Vue Router
app.use(router)

// 设置路由守卫
import { setupRouterGuard } from './router/guard'
setupRouterGuard(router)

// 使用Element Plus组件库
app.use(ElementPlus)

// 初始化用户状态
const userStore = useUserStore()
userStore.init()

// 挂载应用
app.mount('#app')